{% extends "main/base.html" %}
{% load i18n main_tag %}
{% block title %}{% trans '更新客户资料' %}{% endblock %}
{% block content %}
<div class="row">
    <aside class="profile-nav col-lg-3">
        <section class="panel">
            <div class="user-heading round">
                <h1>{{ object.name }}</h1>
                <p>{{ object.company }}</p>
            </div>
            <ul class="nav nav-pills nav-stacked">
                <li><a href="{% url 'main:client_detail' object.pk %}"> <i class="fa fa-user"></i> {% trans "客户详情" %} <span class="label label-danger pull-right r-activity">{{ object.order_count }}</span></a></li>
                <li class="active"><a href="{% url 'main:client_update' object.pk %}"> <i class="fa fa-edit"></i> {% trans "编辑资料" %} </a></li>
            </ul>
        </section>
    </aside>
    <aside class="profile-info col-lg-9">
        <section class="panel">
            <div class="panel-heading">
                {% trans '更新客户资料' %}
            </div>
            <div class="panel-body">
                <form method="post" class="form-horizontal">{% csrf_token %}
                    {{ form.non_field_errors }}
                    {% if request.user.is_authenticated %}
                    <input type="hidden" name="created_by" id="id_created_by" value="{{ request.user.id }}">
                    {% endif %}
                    <div class="form-group col-md-12" align="right">
                        <button type="submit" class="btn btn-primary" value="Update">{% trans "更新" %}</button>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.name.label_tag }}</div>
                        <div class="col-lg-4">{{ form.name }}{{ form.name.errors }}</div>
                        <div class="col-lg-2">{{ form.gender.label_tag }}</div>
                        <div class="col-lg-4">{{ form.gender }}{{ form.gender.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.mobile.label_tag }}</div>
                        <div class="col-lg-4">{{ form.mobile }}{{ form.mobile.errors }}</div>
                        <div class="col-lg-2">{{ form.fax.label_tag }}</div>
                        <div class="col-lg-4">{{ form.fax }}{{ form.fax.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.wechat.label_tag }}</div>
                        <div class="col-lg-4">{{ form.wechat }}{{ form.wechat.errors }}</div>
                        <div class="col-lg-2">{{ form.email.label_tag }}</div>
                        <div class="col-lg-4">{{ form.email }}{{ form.email.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.tax_code.label_tag }}</div>
                        <div class="col-lg-4">{{ form.tax_code }}{{ form.tax_code.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.bank.label_tag }}</div>
                        <div class="col-lg-4">{{ form.bank }}{{ form.bank.errors }}</div>
                        <div class="col-lg-2">{{ form.bank_account.label_tag }}</div>
                        <div class="col-lg-4">{{ form.bank_account }}{{ form.bank_account.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.company.label_tag }}</div>
                        <div class="col-lg-10">{{ form.company }}{{ form.company.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.company_address.label_tag }}</div>
                        <div class="col-lg-10">{{ form.company_address }}{{ form.company_address.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.post_address.label_tag }}</div>
                        <div class="col-lg-10">{{ form.post_address }}{{ form.post_address.errors }}</div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">{{ form.desc.label_tag }}</div>
                        <div class="col-lg-10">{{ form.desc }}{{ form.desc.errors }}</div>
                    </div>
                    <div class="form-group col-md-12" align="right">
                        <button type="submit" class="btn btn-primary" value="Update">{% trans "更新" %}</button>
                    </div>
                </form>
            </div>
        </section>
    </aside>
</div>
{% endblock %}